package com.hsjk.szwj.module.official.service.app;

import cn.hutool.core.util.ObjectUtil;
import com.hsjk.szwj.framework.common.exception.ServiceException;
import com.hsjk.szwj.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.hsjk.szwj.module.official.controller.app.app.vo.AppBindOfficialWebsiteAppRespVO;
import com.hsjk.szwj.module.official.dal.dataobject.app.OfficialWebsiteAppDO;
import com.hsjk.szwj.module.official.dal.mysql.app.IOfficialWebsiteAppMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/07/31 22:41
 **/
@Service
@Validated
@Slf4j
public class OfficialWebsiteAppServiceImpl implements IOfficialWebsiteAppService {

    @Resource
    private IOfficialWebsiteAppMapper officialWebsiteAppMapper;


    @Override
    public List<AppBindOfficialWebsiteAppRespVO> listBindOfficialWebSiteApp() {
        return officialWebsiteAppMapper.listBindOfficialWebSiteApp();
    }

    @Override
    public List<OfficialWebsiteAppDO> getAppListByAppCategoryId(Integer appCategoryId) {
        if (ObjectUtil.isNull(appCategoryId)) {
            throw new ServiceException(GlobalErrorCodeConstants.BAD_REQUEST.getCode()
                    , "参数不能为空");
        }
        return officialWebsiteAppMapper.getAppListByAppCategoryId(appCategoryId);
    }
}
